-
Notifications
You must be signed in to change notification settings - Fork 22.7k
Grammar inconsistency in box-shadow syntax example: | vs. && #39659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You are correct that the comment here is definitely wrong. Please let us know if you find any other cases like this. |
In almost all the pages which contain a Syntax section. |
Yeah, it appears that this is a convention :/ We need to see if it's intended. |
Note that the spec does not require the |
@Psychpsyo Here the problem is in grammar in all the pages which contain a Syntax section. |
Even if intentional, the grammar is really confusing with respect to w3.org grammar. |
Thanks for reporting this, @kannanwisen.
is incorrect; it doesn't reflect the intended syntax. What should suffice is the prose-style comment before it, that is:
We should get rid of all these comments:
Can you link a few other pages where you see this issue? Thanks! Would you be willing to open a PR to send a fix? |
I am not able to recall right now. Surely, I will check and inform. I will open the PR soon. |
For example https://developer.mozilla.org/en-US/docs/Web/CSS/margin also has this problem |
If there is an issue with margin, then padding and border will likely have a similar issue. |
Uh oh!
There was an error while loading. Please reload this page.
MDN URL
https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
What specific section or headline is this issue about?
Syntax CSS
What information was incorrect, unhelpful, or incomplete?
I've noticed a recurring issue with the syntax notation in example comments across MDN Web Docs pages. This often leads to confusion when trying to interpret the required components of CSS properties based on formal grammar.
For example, on the box-shadow page:
URL: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
Under the "Syntax" section, an example comment provides:
CSS
The Problem:
In this specific example, the box-shadow property must contain a color and two length values (at minimum, for offset-x and offset-y). However, the comment uses the pipe symbol |.
According to standard BNF (Backus-Naur Form) grammar and even within the specific CSS Value Definition Syntax, the | symbol denotes an "OR" relationship, meaning one choice out of several options. This directly contradicts the requirement for these components to be combined (AND), not chosen exclusively (OR).
What did you expect to see?
Suggestion for Improvement:
To accurately represent that these components are all required as part of the combined value, the syntax comment should use && (double ampersand), which in CSS Value Definition Syntax signifies that 'all components must be present, and their order is arbitrary.'
Therefore, I suggest the syntax comment be rewritten as follows:
CSS
This correction would greatly improve clarity and align the example comments more closely with formal CSS grammar principles, reducing potential confusion for developers.
Do you have any supporting links, references, or citations?
In all MDN Web Docs where Syntax CSS available
Do you have anything more you want to share?
No response
The text was updated successfully, but these errors were encountered: